import React from 'react'
import { Modal, Form, Input } from 'antd'
const FormItem = Form.Item;
const formItemLayout = {
    labelCol: {
        span: 8,
    },
    wrapperCol: {
        span: 14,
    }
};

class AddSpecialty extends React.Component {
    render() {
        const { visible, onOk, onCancel, form, data } = this.props;
        console.log(data)
        const { getFieldDecorator } = form;
        return (
            <Modal
                title="新增专业"
                visible={visible}
                onOk={onOk}
                onCancel={onCancel}
                okText="确认"
                cancelText="取消"
            >
                <Form>
                    <FormItem label="专业名称" {...formItemLayout}>
                        {getFieldDecorator('specialty', {
                            initialValue: data ? data.specialty : '',
                            rules: [
                                { required: true, message: '专业名称不得为空' },
                            ],
                        })(
                            <Input placeholder="请输入专业名称" />
                        )}
                    </FormItem>
                </Form>
            </Modal>
        )
    }
}

export default Form.create()(AddSpecialty)